package ru.compft.site.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import ru.compft.site.spring.validator.Foo;
import ru.compft.site.spring.validator.FooValidator;

import javax.validation.Valid;

/**
 * User: ASUS
 * Date: 20.10.12
 * Time: 11:15
 * Тестовый пример контроллера с валидатором
 */
//@Controller
public class MyController {
//    @InitBinder
    protected void initBinder(WebDataBinder binder) {
        binder.setValidator(new FooValidator());
    }

//    @RequestMapping(value = "/foo", method= RequestMethod.POST)
//    public void processFoo(@Valid Foo foo) {
//        System.out.println("foo = " + foo);
//    }
}
